﻿
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
   <head>
      <title></title>
      <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
      <script type="text/javascript" src="http://ecn.dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=6.3"></script>
      <script type="text/javascript">
          var map = null;

          function GetMap() {
              map = new VEMap('myMap');
              map.LoadMap();
          }

          function addRandomPins(num) {
              var bounds = map.GetMapView();
              var northWest = bounds.TopLeftLatLong;
              var southEast = bounds.BottomRightLatLong;
              var lngSpan = northWest.Longitude - southEast.Longitude;
              var latSpan = southEast.Latitude - northWest.Latitude;

              var start = new Date().getTime();
              var shapes = [];
              for (i = 0; i < num; i++) {
                  var pin = new VEShape(VEShapeType.Pushpin, new VELatLong(northWest.Latitude + latSpan * Math.random(), southEast.Longitude + lngSpan * Math.random()));
                  shapes.push(pin);
              }
              map.AddShape(shapes);

              var end = new Date().getTime();
              var time = end - start;
              document.getElementById("results").value += '\nExecution time: ' + time;
          }
      </script>
   </head>
   <body onload="GetMap();">
      <div id='myMap' style="position:relative; width:800px; height:600px;"></div>
      <p><input type="text" id="numpins" value="100" /><input type="button" value="add pins" onclick="addRandomPins(document.getElementById('numpins').value)" /></p>
      <textarea id="results" cols="50" rows="10"></textarea>
   </body>
</html>
      